home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7374 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  58 lines

  1. Path: solon.com!not-for-mail
  2. From: Tony Houghton <tonyh@tcp.co.uk>
  3. Newsgroups: comp.lang.c++.moderated,comp.lang.c.moderated,comp.lang.c++,comp.lang.c
  4. Subject: Tool for removing surplus #includes
  5. Date: 22 Feb 1996 18:12:18 -0600
  6. Organization: UWL
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4gj0p3$lp0@solutions.solon.com>
  10. NNTP-Posting-Host: solutions.solon.com
  11. X-Newsreader: Messenger v0.17 for RISC OS
  12. X-Posting-Agent: RISC OS Newsbase 0.55-pre-12a
  13.  
  14. Does anyone know of a PD tool available with portable(ish) source for
  15. removing surplus #include directives? For example:
  16.  
  17. /* "file2.h" */
  18. #include "file1.h"
  19.  
  20. -------------------
  21.  
  22. /* "file3.h" */
  23. #include "file1.h"
  24. #include "file2.h"
  25.  
  26. -------------------
  27.  
  28. #include "file1.h" could be removed from "file3.h". This sort of thing
  29. saves a lot of compiler time without having the chore of typing:
  30.  
  31. #ifndef __file1_h
  32. #include "file1.h"
  33. #endif
  34.  
  35. Ideally the tool should be able to remove the #ifndef structure as well.
  36.  
  37. I know I will still need to do:
  38.  
  39. /* "file1.h" */
  40. #ifndef __file1_h
  41. #define __file1_h
  42. /* Body of file */
  43. #endif
  44.  
  45. but having an additional check around any #include directives or not
  46. doing the include at all saves the compiler lots of time having to load
  47. a file it's already included.
  48.  
  49. My C compiler does have an include_only_once pragma, but it doesn't seem
  50. to work in CFront.
  51.  
  52. -- 
  53. Tony Houghton                     tonyh@tcp.co.uk
  54. Using an Acorn RiscPC 700         http://www.tcp.co.uk/~tonyh/
  55. No Intel inside, no Microsoftware, no hassles
  56. ----------------------------------------------------------------
  57. The Internet is a most invaluable resource for Internet software
  58.